package com.metaera.app.controller.presenter;

import com.metaera.app.controller.core.SimplePaginationPresenter;
import com.metaera.app.data.DataRepository;
import com.metaera.app.data.model.BasicListResponse;
import com.metaera.app.data.model.SearchResultResponse;
import com.metaera.app.data.network.ApiParam;

import io.reactivex.Observable;

/**
 * 搜索更多
 */
public class SearchMoreListPresenter extends SimplePaginationPresenter<SearchResultResponse> {

    private String keyword;

    private final int orderType, timeType, type;

    public SearchMoreListPresenter(String keyword, int orderType, int timeType, int type) {
        this.type = type;
        this.keyword = keyword;
        this.orderType = orderType;
        this.timeType = timeType;
    }

    public void setParamsAndExecute(String keyword) {
        this.keyword = keyword;
        requestRefresh();
    }


    @Override
    protected Observable<BasicListResponse<SearchResultResponse>> execute() {
        return DataRepository.getInstance()
                .searchMore(keyword, orderType, timeType, type, mPage, ApiParam.PAGE_SIZE);
    }

}
